/*
 * Commom.h
 *
 *  Created on: 2011-6-17
 *      Author: ryan
 */

#ifndef COMMOM_H_
#define COMMOM_H_

#include "bmp.h"
#include "MapReducer.h"
#include "Scheduler.h"

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/stat.h>

#define MACHINES 1
#define DEVIDE 3
#define INF 196608000
#define ERR 196608000
#define LIMIT 2
#define DMAX 765
#define BLOCK_NUM 16
#define THREAD_NUM 256
#define TOTAL BLOCK_NUM * THREAD_NUM

#define calculateTime(aled, alst)	(double)(aled.tv_sec - alst.tv_sec)+(double)(aled.tv_usec - alst.tv_usec)/1000000

typedef struct accm{
	unsigned int dxx;
	unsigned int dxy;
	unsigned int dyx;
	unsigned int dyy;
	unsigned char x0;
	unsigned char y0;
}ACCM;

typedef struct point{
	unsigned int x, y;
	unsigned char x0, y0;
}POINT;

char inputImageFileName[128]; 	//Input Image's file name;
char refImageFileName[128]; 	//Reference Image's file name;
char outFilePath[128];		//The path for outputting the result image;

Image inp, ref, out;		//Input, reference and output image;
unsigned char** isPicked;

int task_width, task_height;
int task_start_point, rank;
int sizer, sizei, bestx, besty;

struct timeval alst,aled, st, end;
double split_task_time, alg_image_init_time, nextcdp_time, backtrace_time, alg_finalize_time, overhead_time, total_time;

#endif /* COMMOM_H_ */
